<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp"%>
<%@ include file="/commons/tag.jsp"%>
<%@ include file="/commons/js/basejs.jsp"%>
<%@ include file="/commons/js/extjs.jsp"%>
<%@ include file="/commons/css/basecss.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<body id="mainBody" class="easyui-layout">
<input class="easyui-textbox" style="width:100px;">
<table id="treeGrid" ></table>
	<div class="easyui-layout" data-options="fit:true,border:false" style="overflow: hidden;width:100%">
        <div data-options="region:'center',border:false"  >
            
        </div>
    </div>
    <div data-options="region:'center'" style="overflow-x: hidden">
		<div id="tabs" class="easyui-tabs" data-options="fit:true,border:false">
			<div id="systemMenu" title="新增">
				<form id="AddForm" method="post">   
				    <div>   
				        <label for="name">商品名称:</label>   
				        <input class="easyui-validatebox" type="text" name="productName" data-options="required:true" />   
				    </div>   
				    <div>   
				        <label for="email">Email:</label>   
				        <input class="easyui-validatebox" type="text" name="email" data-options="validType:'email'" />   
				    </div>   
				    ...    
				</form>  

			</div>
		</div>
	</div>
</div>
	
	<script type="text/javascript">
	$(function(){
		$('#table1').datagrid({
			url: '${base}/SystemProduct/findBySenior',
			fit: true,
			border: false,
			pagination: true,// 分页
			pagePosition: 'bottom',
			idField: 'id',
			pageSize: 20,
			pageList: [10,20,30,50],
			checkOnSelect: true,
			selectOnCheck: true,
			singleSelect: false,
			nowrap: true, 
			rownumbers: true, //显示行号
			showfooter: true, //显示行尾
			pageNumber: 1,
			fitColumns:true,
			sortName: 'updateTime',	//按字段排序
			sortOrder: 'desc',		//倒序
			toolbar:'#datagrid_toolbar',
			columns : [[
			 {field : 'id', title :'id', width : 50, hidden: true},
			 {field : 'productName', title:'商品名称', width : '13%', align : 'center'},
			 {field : 'categoryName', title:'分类名称', width : '13%', align : 'center'},
			 {field : 'productSpec', title:'商品规格', width : '13%', align : 'center'},
			 {field : 'productNumber', title:'商品编号', width : '13%', align : 'center'},
			 {field : 'productPrice', title:'商品价格', width : '13%', align : 'center',sortable:true},
			 {field : 'unitName', title:'单位名称', width : '13%', align : 'center'},
			 {field : 'isDefault', title:'是否默认', width : '13%', align : 'center',sortable:true,
				 	formatter:function(value,row,index){
				 		 if (0 == value) return '否';
						 else if (1 == value) return '是';
						 else return '';
				 	}},
			 {field :'action', title:'操作', width:80, align:'center',
					formatter:function(value,row,index){
						var e = '<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:\'icon-edit\',plain:true" onclick="hiddangerinfo_table_editrow(this)">编辑</a> ';
						var d = '<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:\'icon-del\',plain:true" onclick="hiddangerinfo_table_deleterow(this)">删除</a>';
						return e+d;
					}
				}]],
	   });
	});
		function deletes(){
			/*  swal({
			    title: "确定删除吗？",
			    text: "你将无法恢复该虚拟文件！",
			    type: "warning",
			    showCancelButton: true,
			    confirmButtonColor: "#DD6B55",
			    confirmButtonText: "确定删除！",
			    closeOnConfirm: false
			},
			function(){
			    swal("删除！",
			    "你的虚拟文件已经被删除。",
			    "success");
			});  */
			 var row = $('#table1').datagrid('getSelections');
			var ids = "";
				for(var i in row){
					ids += ","+row[i].id;
				}
				console.info(ids);
			   $.ajax({  
                type : "POST",  
                url : "${base}/SystemProduct/deleteProdect",
                data : {
                	ids: ids
                },
                success : function(result) {
                	if(result == 0){
                    	swal("", "删除失败,包含默认商品","error");
                	} else {
                		/* swal("", "删除成功","success"); */
                	}
                	$('#table1').datagrid('load',{
						condition: $('#keyword').val(),
						facId: $('#fac').combobox('getValue')
					});
                }  
            });      
		}
		function doSearch(){
			$('#table1').datagrid('load',{
				condition: $('#keyword').val(),
				facId: $('#fac').combobox('getValue')
			});
		}
	</script>
</body>
</html>